package com.ley.springboot.seed.business.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ley.springboot.seed.constants.ProjectConstants;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 *
 * </p>
 *
 * @author author
 * @since 2020-06-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_user")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @JsonSerialize(using= ToStringSerializer.class)
    @TableId("id")
    private Long id;

    /**
     * 姓名
     */
    @TableField("user_name")
    private String userName;

    /**
     * 年龄
     */
    @TableField("user_age")
    private Integer userAge;

    /**
     * 创建时间
     * **/
    @DateTimeFormat(pattern = ProjectConstants.FORMAT_TIME_PATTERN)
    @JsonFormat(pattern = ProjectConstants.FORMAT_TIME_PATTERN,timezone = ProjectConstants.TIME_ZONE)
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    private Date createTime;
}
